
/**
 * @file formats.c
 * file format registration and detection header
 */

#ifndef FORMATS_H
#define FORMATS_H

#include "common.h"

#include <stdio.h>

/* supported file formats */
enum PcmFileFormat {
    PCM_FORMAT_UNKNOWN = -1,
    PCM_FORMAT_RAW     =  0,
    PCM_FORMAT_WAVE    =  1,
    PCM_FORMAT_AIFF    =  2,
    PCM_FORMAT_CAFF    =  3
};

struct PcmFile;

typedef struct PcmFormat {
    const char *name;
    const char *long_name;
    int format;
    int (*probe)(uint8_t *data, int size);
    int (*init)(struct PcmFile *pf);
    struct PcmFormat *next;
} PcmFormat;

extern void pcmfile_register_all_formats(void);

extern void pcmfile_register_format(PcmFormat *format);

extern PcmFormat *pcmfile_find_format(int format);

extern PcmFormat *pcmfile_probe_format(uint8_t *data, int size);

#endif /* FORMATS_H */
